/* 
 * Copyright 2009 Michal Trzcinka
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed
 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 * 
 */

/**
 * vCard YUI widget
 */
YAHOO.namespace('TRZCINKA.VCARD');

(function() {

  var LOGGER = new YAHOO.widget.LogWriter('vcard.js');

  LOGGER.log('Initializing TRZCINKA.VCARD.VCard module...', 'info');

  var Dom = YAHOO.util.Dom,
      Panel = YAHOO.widget.Panel;

  /**
   * Instantiates VCard widget.
   *
   * @param id id of element where the VCard should be appended to.
   * @param gridModel gridModel instance.
   */
  YAHOO.TRZCINKA.VCARD.VCard = function(id, gridModel) {

    var elementId = id || Dom.generateId();

    YAHOO.TRZCINKA.VCARD.VCard.superclass.constructor.call(this, elementId,
    {
      fixedcenter: false,
      underlay: "none",
      close: false,
      visible: true,
      draggable: false
    }
        );

    this.setHeader("");
    this.setBody(''); //creates body
    new YAHOO.TRZCINKA.VCARD.GridView(this.body, gridModel);
  };

  YAHOO.lang.extend(YAHOO.TRZCINKA.VCARD.VCard, Panel);

})();
